<?php
/**
 * Created by PhpStorm.
 * User: a4041
 * Date: 2018/6/13
 * Time: 13:46
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Laravel\Scout\Searchable;
//use Illuminate\Database\Eloquent\SoftDeletes;
class ShopDish extends Model
{
//    use Searchable;
    use SoftDeletes;
    protected $guarded = ['id'];
    protected $table = 'shop_dishes';
    protected $hidden = ['id_pic','id_pic_back','lience_pic','user_id'];

    public function dishAttribute(){

        return $this->hasMany('App\Models\ShopDishAttribute','dish_id','id');
    }

    public function attribute(){

        return $this->hasMany('App\Models\ShopDishAttribute','dish_id','id');
    }


//    public function searchableAs()
//    {
//        return "shop_dishes";
//    }
//
//    public function toSearchableArray()
//    {
//        return [
//            'title' =>$this->dishes_name,
//            'status'=>$this->status,
//        ];
//    }

    public function shop()
    {
        return $this->belongsTo('App\Models\Shop');
    }

    public function shop_menu()
    {
        return $this->hasOne(ShopMenu::class,'id','menu_id');
    }
}